package com.prayerdiary.utils;

import android.app.ProgressDialog;
import android.content.Context;

public class PDProgressDialog
{
	private ProgressDialog pDialog = null;

	private boolean isShown = false;

	private static PDProgressDialog me;

	public void showDialog(Context context)
	{
		if (!isShown)
		{
			try
			{
				pDialog = ProgressDialog.show(context, "", "Loading Please wait...", true);
			}
			catch (Exception e)
			{
				e.printStackTrace();
				Utils.println("PDProgressDialog on showDialog ERROR = " + e);
			}
			isShown = true;
		}
	}

	public void hideDialog()
	{
		if (pDialog != null) if (isShown)
		{
			pDialog.dismiss();
			isShown = false;
		}
	}

	public static PDProgressDialog getInstanse()
	{
		if (me == null)
		{
			me = new PDProgressDialog();
		}
		return me;
	}
}